home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Special 25 / AMIGAplus Sonderheft 25 (2000)(Falke)(DE)(Track 1 of 4)[!].iso / Updates / PowerPC / pdflib / bind / vb / hello.bas next >
BASIC Source File  |  2000-05-16  |  1KB  |  51 lines

  1. Attribute VB_Name = "Module1"
  2. '
  3. ' hello.bas
  4. ' Copyright (C) 1997-99 Thomas Merz. All rights reserved.
  5. '
  6. ' PDFlib client: hello example in Visual Basic
  7. ' Requires the PDFlib type library
  8. ' Load pdflib_vb.tlb via Project, References, Browse
  9.  
  10. Option Explicit
  11.  
  12.  
  13. Sub main()
  14.     Dim p As Long
  15.     Dim err, font As Integer
  16.     
  17.     p = PDF_new
  18.     
  19.     ' Open new PDF file
  20.     err = PDF_open_file(p, "hello_vb.pdf")
  21.     If (err = -1) Then
  22.         MsgBox "Couldn't open PDF file!"
  23.         End
  24.     End If
  25.     
  26.     PDF_set_info p, "Creator", "hello.bas"
  27.     PDF_set_info p, "Author", "Thomas Merz"
  28.     PDF_set_info p, "Title", "Hello, world (Visual Basic)!"
  29.  
  30.     ' start a new page
  31.     PDF_begin_page p, 595, 842
  32.  
  33.     font = PDF_findfont(p, "Helvetica-Bold", "winansi", 0)
  34.     If (font = -1) Then
  35.         MsgBox "Couldn't set font"
  36.         End
  37.     End If
  38.         
  39.     PDF_setfont p, font, 24
  40.  
  41.     PDF_set_text_pos p, 50, 700
  42.     PDF_show p, "Hello, world!"
  43.     PDF_continue_text p, "(says Visual Basic)"
  44.             
  45.     PDF_end_page p        ' finish page
  46.     
  47.     PDF_close p            ' close PDF document
  48.  
  49.     PDF_delete p
  50. End Sub
  51.